package com.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dao.ZixunDao;
import com.pojo.Jiedairen;
import com.pojo.Zixun;
import com.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ZixunService extends ServiceImpl<ZixunDao , Zixun> {

    @Autowired
    private  ZixunDao zixunDao;
    public IPage getZixunPage(int page, int limit, String zxname) {
        Page p=new Page(page,limit);
        QueryWrapper<Zixun> qw=new QueryWrapper<>();
        if (StringUtil.isNotNull(zxname)){
            qw.like("zxname",zxname);
        }
        qw.orderByDesc("zxtime");
        IPage iPage=zixunDao.selectPage(p,qw);
        return iPage;
    }

    public int getUnhandled() {
        QueryWrapper q = new QueryWrapper();
        q.isNull("linkman");
       return zixunDao.selectCount(q);
    }
}
